{literal}
<script type="text/javascript">
function popUpWindow(url, widthWin, heightWin, title){
	reloadPage = false;
	$("#messageBox").dialog('destroy').html({/literal}'{capture name="displayJobProgressBar"}<img style="vertical-align: middle;" src="{$GLOBALS.site_url}/system/ext/jquery/progbar.gif" alt="[[Please wait ...]]" /> [[Please wait ...]]{/capture}{$smarty.capture.displayJobProgressBar|escape:'quotes'}'{literal});
	$("#messageBox").dialog({
		width:widthWin,
		height:heightWin,
		title:title
	}).dialog('open');

	$.get(url, function (data) {
		$("#messageBox").html(data);
	});

	return false;
}
</script>
{/literal}

<div class="clr"><br/></div>

<div class="box" id="displayResults">
	<div class="box-header">
		<div class="resultsnumber"><strong>{$paymentsCount}</strong> [[Payments]]</div>
		<div class="pagination">
		{foreach from=$pages item=page}
			{if $page == $currentPage}
				<strong>{$page}</strong>
				{else}
				{if $page == $totalPages && $currentPage < $totalPages-3} ... {/if}
				<a
					href="?page={$page}{if $sorting_field ne null}&sorting_field={$sorting_field}{/if}{if $sorting_order ne null}&sorting_order={$sorting_order}{/if}&items_per_page={$items_per_page}{$searchFields}">{$page}</a>
				{if $page == 1 && $currentPage > 4} ... {/if}
			{/if}
		{/foreach}
		</div>
		<div class="numberPerPage">
			[[per page]]:
			<select id="items_per_page" name="items_per_page"
			        onchange="window.location = '?restore=1&sorting_field={$sorting_field}&sorting_order={$sorting_order}&items_per_page=' + this.value;" class="perPage">
				<option value="10" {if $items_per_page == 10}selected="selected"{/if}>10</option>
				<option value="20" {if $items_per_page == 20}selected="selected"{/if}>20</option>
				<option value="50" {if $items_per_page == 50}selected="selected"{/if}>50</option>
				<option value="100" {if $items_per_page == 100}selected="selected"{/if}>100</option>
			</select>
		</div>
	</div>
	<div class="innerpadding">
		<div id="displayResultsTable">
			<table width=100%>
				<thead>
				<tr>
					<th>
						<a href="?restore=1&sorting_field=date&sorting_order={if $sorting_order == 'ASC' && $sorting_field == 'date'}DESC{else}ASC{/if}&items_per_page={$items_per_page}">[[Date]]</a>
						{if $sorting_field == 'date'}
							{if $sorting_order == 'ASC'}
								<img src="{image}b_up_arrow.gif" alt="{tr}Up{/tr|escape:'html'}" title="{tr}Up{/tr|escape:'html'}" />
							{else}
								<img src="{image}b_down_arrow.gif" alt="{tr}Down{/tr|escape:'html'}" title="{tr}Down{/tr|escape:'html'}" />
							{/if}
						{/if}
					</th>
					<th>
						<a href="?restore=1&sorting_field=gateway&sorting_order={if $sorting_order == 'ASC' && $sorting_field == 'gateway'}DESC{else}ASC{/if}&items_per_page={$items_per_page}">[[Gateway]]</a>
						{if $sorting_field == 'gateway'}
							{if $sorting_order == 'ASC'}
								<img src="{image}b_up_arrow.gif" alt="{tr}Up{/tr|escape:'html'}" title="{tr}Up{/tr|escape:'html'}" />
							{else}
								<img src="{image}b_down_arrow.gif" alt="{tr}Down{/tr|escape:'html'}" title="{tr}Down{/tr|escape:'html'}" />
							{/if}
						{/if}
					</th>
					<th>
						<a href="?restore=1&sorting_field=message&sorting_order={if $sorting_order == 'ASC' && $sorting_field == 'message'}DESC{else}ASC{/if}&items_per_page={$items_per_page}">[[Gateway Response]]</a>
						{if $sorting_field == 'message'}
							{if $sorting_order == 'ASC'}
								<img src="{image}b_up_arrow.gif" alt="{tr}Up{/tr|escape:'html'}" title="{tr}Up{/tr|escape:'html'}" />
							{else}
								<img src="{image}b_down_arrow.gif" alt="{tr}Down{/tr|escape:'html'}" title="{tr}Down{/tr|escape:'html'}" />
							{/if}
						{/if}
					</th>

					<th>
						<a href="?restore=1&sorting_field=status&sorting_order={if $sorting_order == 'ASC' && $sorting_field == 'status'}DESC{else}ASC{/if}&items_per_page={$items_per_page}">[[Status]]</a>
						{if $sorting_field == 'status'}
							{if $sorting_order == 'ASC'}
								<img src="{image}b_up_arrow.gif" alt="{tr}Up{/tr|escape:'html'}" title="{tr}Up{/tr|escape:'html'}" />
							{else}
								<img src="{image}b_down_arrow.gif" alt="{tr}Down{/tr|escape:'html'}" title="{tr}Down{/tr|escape:'html'}" />
							{/if}
						{/if}
					</th>
				</tr>
				</thead>
			{foreach from=$found_payments item=found_payment name=payments_block}
				<tr id="users[{$found_user.sid}]" class="{cycle values = 'evenrow,oddrow'}">
					<td width=10%>{tr type="date"}{$found_payment.date}{/tr}</td>
					<td width=16%>{$found_payment.gateway}</td>
					<td><a href="{$GLOBALS.site_url}/payment-log/display-message/"
					       onClick="popUpWindow('{$GLOBALS.site_url}/payment-log/?action=display_message&sid={$found_payment.sid}',420, 450, '[[Viewing Gateway Response]]'); return false;">
						<pre>{$found_payment.message|truncate:100}</pre>
					</a></td>
					<td width=11%>[[{$found_payment.status}]]</td>
				</tr>
			{/foreach}
			</table>
		</div>
	</div>
	<div class="box-footer">
		<div class="pagination">
		{foreach from=$pages item=page}
			{if $page == $currentPage}
				<strong>{$page}</strong>
				{else}
				{if $page == $totalPages && $currentPage < $totalPages-3} ... {/if}
				<a
					href="?page={$page}{if $sorting_field ne null}&sorting_field={$sorting_field}{/if}{if $sorting_order ne null}&sorting_order={$sorting_order}{/if}&items_per_page={$items_per_page}{$searchFields}">{$page}</a>
				{if $page == 1 && $currentPage > 4} ... {/if}
			{/if}
		{/foreach}
		</div>
	</div>
</div>